package ink.teamwork.battery.controller

import ink.teamwork.battery.service.CouponService
import ink.teamwork.battery.service.UserService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/coupon")
class CouponController : BaseController() {

    @Autowired
    lateinit var couponService: CouponService

    @PostMapping("/send/{openId}")
    fun send(@PathVariable openId: String) {
        couponService.send(openId)
    }

    @GetMapping("/my")
    fun list() {
        couponService.getCouponList(getCurrentUser().openId)
    }

    @GetMapping("/user")
    fun userCouponList() {
        couponService.getUserCouponList()
    }

}